package com.idol.controller;

import com.idol.pojo.Resume;
import com.idol.service.IResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author Supreme_Sir
 * @version 1.0
 * @className ResumeController
 * @description
 * @date 2020/11/1 19:02
 **/
@Controller
@RequestMapping("resume")
public class ResumeController {
    @Autowired
    private IResumeService resumeService;

    @RequestMapping("all")
    public ModelAndView findAll(ModelAndView modelAndView) {
        modelAndView.addObject("resumes", resumeService.findAll());
        modelAndView.setViewName("index");
        return modelAndView;
    }

    @RequestMapping("insert")
    public String insert(Resume resume) {
        resumeService.insert(resume);
        return "redirect:/resume/all";
    }

    @RequestMapping("delete")
    public String delete(Resume resume) {
        resumeService.delete(resume);
        return "redirect:/resume/all";
    }

    @RequestMapping("update")
    public String update(Resume resume) {
        resumeService.update(resume);
        return "redirect:/resume/all";
    }

}
